import type { FormInstance, FormRules } from "element-plus";
import { reactive, ref } from "vue";

/**
 * @description 配置项
 */
export const headerConfig = [
  {
    type: "input",
    // title: "部门名称",
    value: "name",
    clearable: true,
    placeholder: "请输入部门名称",
  },
];

/**
 * @description 搜索数据
 */
export const configData = ref({
  name: "",
});

/**
 * @description 表格配置
 */
export const tableConfig = [
  {
    prop: "name",
    label: "部门名称",
    width: "150",
  },
  {
    prop: "sn",
    label: "部门编号",
    // width: "150",
  },
];

/**
 * @description 表格操作项
 */
export const tableOptionList = [
  // { type: "primary", name: "人员", option: "person", permission: "" },
  {
    type: "success",
    name: "编辑",
    option: "edit",
    permission: "department:saveOrUpdate",
  },
  {
    type: "danger",
    name: "删除",
    option: "delete",
    permission: "department:delete",
  },
];

/**
 * @description 表格数据
 */
export const tableList = ref([]);

/**
 * @description 添加数据表单实例
 */
export const addDataRef = ref<FormInstance>();

/**
 * @description 添加数据表单规则
 */
export const addDataRules = reactive<FormRules>({
  name: [{ required: true, message: "请输入部门名称", trigger: "blur" }],
  sn: [{ required: true, message: "请输入部门编号", trigger: "blur" }],
});
